package cn.zhangxd.svca.client;

import cn.zhangxd.svca.exception.MaintenanceException;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;

@RefreshScope
@Component
public class ServiceBClientFallback implements ServiceBClient {

        private static final Logger LOGGER = LoggerFactory.getLogger(ServiceBClientFallback.class);

        @Value("${status.svcb-service}")
        private String status;

        @Override
        public String printServiceB() {
            LOGGER.info("异常发生，进入fallback方法");
            String hour = "1";
            String[] _status = status.split(",");
            if( _status.length>1)hour = _status[1];
            if("mtn".equals(_status[0])){
              //  return "svcb-service模块维护中...估计"+hour+"小时后恢复！";
                LOGGER.info("svcb-service模块维护中...估计"+hour+"小时后恢复！");
                return "1svcb-service模块维护中...估计"+hour+"小时后恢复！";
            }
            return "$svcb-service不可用"+status;
        }
    }